import request from "@/utils/request";
import { LIST_URL } from "@/config";

// 查询字典类型列表
export function listType(data) {
  return request({
    url: LIST_URL + "/system/dic/type/list",
    method: "post",
    data: data,
  });
}

// 查询字典类型详细
export function getType(dictId) {
  return request({
    url: "/api/system/dic/type/getById?id=" + dictId,
    method: "get",
  });
}

// 新增字典类型
export function addType(data) {
  return request({
    url: "/api/system/dic/type/insert",
    method: "post",
    data: data,
  });
}

// 修改字典类型
export function updateType(data) {
  return request({
    url: "/api/system/dic/type/update",
    method: "post",
    data: data,
  });
}

// 删除字典类型
export function delType(data) {
  return request({
    url: "/api/system/dic/type/delete",
    method: "post",
    data: data,
  });
}

// 查询字典数据列表
export function listData(data) {
  return request({
    url: "/api/system/dic/data/list",
    method: "post",
    data: data,
  });
}

// 查询字典数据详细
export function getData(dictCode) {
  return request({
    url: "/api/system/dic/data/getById?id=" + dictCode,
    method: "post",
  });
}

// 根据字典类型查询字典数据信息
export function getDictsApi(dictTypes) {
  return request({
    url: LIST_URL + "/system/dict/getDictByType",
    method: "post",
    data: dictTypes,
  });
}

// 新增字典数据
export function addData(data) {
  return request({
    url: "/api/system/dic/data/insert",
    method: "post",
    data: data,
  });
}

// 修改字典数据
export function updateData(data) {
  return request({
    url: "/api/system/dic/data/update",
    method: "post",
    data: data,
  });
}

// 删除字典数据
export function delData(data) {
  return request({
    url: "/api/system/dic/data/delete",
    method: "post",
    data: data,
  });
}
